package com.dwxt.cdms.controller;

import com.dwxt.cdms.base.Page;
import com.dwxt.cdms.entity.HealthSummaryYear;
import com.dwxt.cdms.service.HealthSummaryYearService;
import com.dwxt.common.base.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/cdms/healthSummaryYear")
@RestController
public class HealthSummaryYearController {

    @Autowired
    private HealthSummaryYearService healthSummaryYearService;

    /***
     * 年度报告分页
     * @param healthSummaryYear
     * @param page
     * @param type
     * @return
     */
    @RequestMapping("/selectHealthSummaryYearPage")
    public BaseResult selectHealthSummaryYearPage(HealthSummaryYear healthSummaryYear, Page page,Integer type) {
        return healthSummaryYearService.selectHealthSummaryYearPage(healthSummaryYear, page,type);
    }

    /**
     * 更新年度报告
     * @param healthSummaryYear
     * @return
     */
    @RequestMapping("/updateHealthSummaryYear")
    public BaseResult updateHealthSummaryYear(HealthSummaryYear healthSummaryYear){
        return healthSummaryYearService.updateHealthSummaryYear(healthSummaryYear);
    }

    /**
     * 查询相关的4个季度总结
     * @param id
     * @return
     */
    @RequestMapping("/selectHealthSummaryById")
    public BaseResult selectHealthSummaryById(Integer id){
        return BaseResult.ok(healthSummaryYearService.selectHealthSummaryById(id));
    }

    @RequestMapping("/selectHealthSummaryByCustomerId")
    public BaseResult selectHealthSummaryByCustomerId(Page page,Integer customerId){
        return healthSummaryYearService.selectHealthSummaryByCustomerId(page,customerId);
    }

    /**
     * 查询前一个年度报告
     * @param id
     * @return
     */
    @RequestMapping("/selectPreviousRecord")
    public BaseResult selectPreviousRecord(Integer id){
        return healthSummaryYearService.selectPreviousRecord(id);
    }

    /**
     * 查询不包括当前年度报告的 分页
     * @param page
     * @param id
     * @return
     */
    @RequestMapping("/selectHistoryPage")
    public BaseResult selectHistoryPage(Page page, Integer id){
        return healthSummaryYearService.selectHistoryPage(page,id);
    }

}
